﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ZG_member.BLL;
using System.Configuration;

namespace ZG_member
{
    public partial class RollInfo : Form
    {
        public RollInfo()
        {
            InitializeComponent();
            this.Opacity = 0;
        }

        private void RollInfo_Load(object sender, EventArgs e)
        {
            this.timer1.Start();
            dgvroleInfoBind();
            skinEngine1.SkinFile = Application.StartupPath + ConfigurationManager.AppSettings["Skin"];
        }
        /// <summary>
        /// 加载数据
        /// </summary>
        public void dgvroleInfoBind()
        {
            roleInfo info = new roleInfo();
            DataTable dt = info.GetList("").Tables[0];
            dgvroleInfo.DataSource = dt;
            dgvroleInfo.Columns["roleInfo1"].Visible = false;
            dgvroleInfo.Columns["specialrebate"].Visible = false;
            dgvroleInfo.AllowUserToAddRows = false;
            
            foreach (DataGridViewRow dgv in dgvroleInfo.Rows)
            {
                string charge = dgv.Cells["roleInfo1"].Value.ToString();
                string charge1 = dgv.Cells["specialrebate"].Value.ToString();
                dgv.Cells["teshuzhekou"].Value = charge1 == "1" ? true : false;
                int i = 0;
                //会员消费
                if (charge[i].ToString() == "1")
                {
                    dgv.Cells["huiyuanxiaofei"].Value = true;

                }
                else
                {
                    dgv.Cells["huiyuanxiaofei"].Value = false;
                }
                //会员充值
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["huiyuanchongzhi"].Value = true;
                }
                else
                {
                    dgv.Cells["huiyuanchongzhi"].Value = false;
                }
                //if (charge[++i].ToString() == "1")
                //{
                //    dgv.Cells["huiyuanchongzhi"].Value = true;

                //}
                //else
                //{
                //    dgv.Cells["huiyuanchongzhi"].Value = false;
                //}
                //添加会员
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["tianjiahuiyuan"].Value = true;
                }
                else
                {
                    dgv.Cells["tianjiahuiyuan"].Value = false;
                }
                //修改会员
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["xiugaihuiyuan"].Value = true;
                }
                else
                {
                    dgv.Cells["xiugaihuiyuan"].Value = false;
                }
                //删除会员
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["shanchuhuiyuan"].Value = true;
                }
                else
                {
                    dgv.Cells["shanchuhuiyuan"].Value = false;
                }
                //挂失办理
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["guashibanli"].Value = true;
                }
                else
                {
                    dgv.Cells["guashibanli"].Value = false;
                }
             
                //查找会员
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["chazhaohuiyuan"].Value = true;
                }
                else
                {
                    dgv.Cells["chazhaohuiyuan"].Value = false;
                }
                //修改卡密码
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["xiugaikamima"].Value = true;
                }
                else
                {
                    dgv.Cells["xiugaikamima"].Value = false;
                }
                //更换用户
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["genghuanyonghu"].Value = true;
                }
                else
                {
                    dgv.Cells["genghuanyonghu"].Value = false;
                }
                //系统锁屏
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["xitongsuoping"].Value = true;
                }
                else
                {
                    dgv.Cells["xitongsuoping"].Value = false;
                }
                //卡金提醒
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["kajintixing"].Value = true;

                }
                else
                {
                    dgv.Cells["kajintixing"].Value = false;
                }
                //生日提醒
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["shengritixing"].Value = true;
                }
                else
                {
                    dgv.Cells["shengritixing"].Value = false;
                }
              
                //群发短信
                //if (charge[++i].ToString() == "1")
                //{
                //    dgv.Cells["群发短信"].Value = true;
                //}
                //else
                //{
                //    dgv.Cells["群发短信"].Value = false;
                //}
                //群发邮件
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["群发邮件"].Value = true;
                }
                else
                {
                    dgv.Cells["群发邮件"].Value = false;
                }
                //批量会员到出
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["pilianghuiyuandaochu"].Value = true;
                }
                else
                {
                    dgv.Cells["pilianghuiyuandaochu"].Value = false;
                }
                // 统计区块
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["tongjiqukuai"].Value = true;
                }
                else
                {
                    dgv.Cells["tongjiqukuai"].Value = false;
                }
                //课程阶段
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["kechengjieduan"].Value = true;
                }
                else
                {
                    dgv.Cells["kechengjieduan"].Value = false;
                }
                //客户预约
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["kehuyuyue"].Value = true;
                }
                else
                {
                    dgv.Cells["kehuyuyue"].Value = false;
                }
                //讲话设置
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["jianghuashezhi"].Value = true;
                }
                else
                {
                    dgv.Cells["jianghuashezhi"].Value = false;
                }
                //添加用户
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["tianjiayonghu"].Value = true;
                }
                else
                {
                    dgv.Cells["tianjiayonghu"].Value = false;
                }
                //生日提醒设置
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["shengritixingshezhi"].Value = true;
                }
                else
                {
                    dgv.Cells["shengritixingshezhi"].Value = false;
                }
                //会员等级
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["huiyuandengji"].Value = true;
                }
                else
                {
                    dgv.Cells["huiyuandengji"].Value = false;
                }
                //卡面设计
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["kamiansheji"].Value = true;
                }
                else
                {
                    dgv.Cells["kamiansheji"].Value = false;
                }
                //商品设置
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["shangpinshezhi"].Value = true;
                }
                else
                {
                    dgv.Cells["shangpinshezhi"].Value = false;
                }
                //角色管理
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["jueseguanli"].Value = true;
                }
                else
                {
                    dgv.Cells["jueseguanli"].Value = false;
                }
                //销售管理
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["xiaoshouguanli"].Value = true;
                }
                else
                {
                    dgv.Cells["xiaoshouguanli"].Value = false;
                }
                //施工管理
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["shigongguanli"].Value = true;
                }
                else
                {
                    dgv.Cells["shigongguanli"].Value = false;
                }
               
               // 操作员管理
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["caozuoyuanguanli"].Value = true;
                }
                else
                {
                    dgv.Cells["caozuoyuanguanli"].Value = false;
                }
                
                //智能决策管理
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["zhinengjueceguanli"].Value = true;
                }
                else
                {
                    dgv.Cells["zhinengjueceguanli"].Value = false;
                }

            
                // 客户查询
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["kehuchaxun"].Value = true;
                }
                else
                {
                    dgv.Cells["kehuchaxun"].Value = false;
                }
                // 用户贡献
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["yonghugongxian"].Value = true;
                }
                else
                {
                    dgv.Cells["yonghugongxian"].Value = false;
                }
                // 商品查询
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["shangpinchaxun"].Value = true;
                }
                else
                {
                    dgv.Cells["shangpinchaxun"].Value = false;
                }
                //====会员统计===========
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["huiyuantongji"].Value = true;
                }
                else
                {
                    dgv.Cells["huiyuantongji"].Value = false;
                }
                //年龄分析

                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["nianlingfenxi"].Value = true;
                }
                else
                {
                    dgv.Cells["nianlingfenxi"].Value = false;
                }



                

               
                //商品饼图查询
                
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["shangpingbingtuchaxun"].Value = true;
                }
                else
                {
                    dgv.Cells["shangpingbingtuchaxun"].Value = false;
                }
                ////回信统计
                //if (charge[++i].ToString() == "1")
                //{
                //    dgv.Cells["huixintongji"].Value = true;
                //}
                //else
                //{
                //    dgv.Cells["huixintongji"].Value = false;
                //}
                //会员行为记录
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["huiyuanxingweijilu"].Value = true;
                }
                else
                {
                    dgv.Cells["huiyuanxingweijilu"].Value = false;
                }
                //系统日志
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["daoqichaxun"].Value = true;
                }
                else
                {
                    dgv.Cells["daoqichaxun"].Value = false;
                }
                //系统日志
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["xitongrizhi"].Value = true;
                }
                else
                {
                    dgv.Cells["xitongrizhi"].Value = false;
                }
                //收入明细查询
              
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["shourumingxichaxun"].Value = true;
                }
                else
                {
                    dgv.Cells["shourumingxichaxun"].Value = false;
                }
                //折扣查询
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["zhekouchaxun"].Value = true;
                }
                else
                {
                    dgv.Cells["zhekouchaxun"].Value = false;
                }
               

              
                //商品流水
                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["shangpinliushui"].Value = true;
                }
                else
                {
                    dgv.Cells["shangpinliushui"].Value = false;
                }

                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["chonghong"].Value = true;
                }
                else
                {
                    dgv.Cells["chonghong"].Value = false;
                }



                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["xiaofeigaijia"].Value = true;
                }
                else
                {
                    dgv.Cells["xiaofeigaijia"].Value = false;
                }


                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["qingjiaxiugai"].Value = true;
                }
                else
                {
                    dgv.Cells["qingjiaxiugai"].Value = false;
                }

                if (charge[++i].ToString() == "1")
                {
                    dgv.Cells["zhipaixiaoshou"].Value = true;
                }
                else
                {
                    dgv.Cells["zhipaixiaoshou"].Value = false;
                }
                

            }
        }
        public int ID;
        private void btnRollAdd_Click(object sender, EventArgs e)
        {
            ID = 0;
            RollinfoAdd roll = new RollinfoAdd(this);
            roll.ShowDialog();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {

            this.timer2.Start();
        }

        private void btnrollDel_Click(object sender, EventArgs e)
        {
            if (dgvroleInfo.CurrentRow.Cells["roleName"].Value != null && dgvroleInfo.CurrentRow.Cells["roleName"].Value.ToString() == "系统管理员")
            {
                MessageBox.Show("系统管理员不能删除！");
                return;
            }
            if (dgvroleInfo.CurrentRow.Cells["idd"].Value != null)
            {
                int ID = int.Parse(dgvroleInfo.CurrentRow.Cells["idd"].Value.ToString());
                roleInfo info = new roleInfo();
                DialogResult dt = MessageBox.Show("此信息正在使用删除会导致数据错误\r\n您确定要删除该条信息吗？", "温馨提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                if (dt == DialogResult.Yes)
                {
                    if (info.Delete(ID))
                    {
                        dgvroleInfoBind();
                    }
                }
            }
        }

        private void btnuptrollinfo_Click(object sender, EventArgs e)
        {
            updateroll();

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            this.Left += 2;
            this.Opacity += 0.1;
            if (Opacity == 1)
            {
                this.timer1.Stop();

            }

        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            this.Top = this.Top + 10;
            this.Opacity = this.Opacity - 0.06;
            if (Opacity <= 0)
            {
                this.timer2.Stop();
                this.Close();
            }

        }

        private void dgvroleInfo_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            //ID = int.Parse(dgvroleInfo.CurrentRow.Cells["idd"].Value.ToString());
            //if (dgvroleInfo.CurrentRow.Cells["roleName"].Value != null && dgvroleInfo.CurrentRow.Cells["roleName"].Value.ToString() == "系统管理员")
            //{
            //    MessageBox.Show("系统管理员不能修改！");
            //    return;
            //}

            //RollinfoAdd roll = new RollinfoAdd(this);
            //if (dgvroleInfo.CurrentRow.Cells["roleName"].Value != null)
            //{
            //    roll.txtroleName.Text = dgvroleInfo.CurrentRow.Cells["roleName"].Value.ToString();

            //}
            //if (dgvroleInfo.CurrentRow.Cells["huiyuanxiaofei"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["huiyuanxiaofei"].Value.ToString() == "True")
            //    {
            //        roll.huiyuanxiaofei.Checked = true;
            //    }
            //}
            ////if (dgvroleInfo.CurrentRow.Cells["huiyuanchongzhi"].Value != null)
            ////{
            ////    if (dgvroleInfo.CurrentRow.Cells["huiyuanchongzhi"].Value.ToString() == "True")
            ////    {
            ////        roll.huiyuanchongzhi.Checked = true;
            ////    }
            ////}
            //if (dgvroleInfo.CurrentRow.Cells["tianjiahuiyuan"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["tianjiahuiyuan"].Value.ToString() == "True")
            //    {
            //        roll.tianjiahuiyuan.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["xiugaihuiyuan"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["xiugaihuiyuan"].Value.ToString() == "True")
            //    {
            //        roll.xiugaihuiyuan.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["shanchuhuiyuan"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["shanchuhuiyuan"].Value.ToString() == "True")
            //    {
            //        roll.shanchuhuiyuan.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["guashibanli"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["guashibanli"].Value.ToString() == "True")
            //    {
            //        roll.banliguashi.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["jifenhuanli"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["jifenhuanli"].Value.ToString() == "True")
            //    {
            //        roll.jifenhuanli.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["chazhaohuiyuan"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["chazhaohuiyuan"].Value.ToString() == "True")
            //    {
            //        roll.chazhaohuiyuan.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["xiugaimima"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["xiugaimima"].Value.ToString() == "True")
            //    {
            //        roll.xiugaimima.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["genghuanyonghu"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["genghuanyonghu"].Value.ToString() == "True")
            //    {
            //        roll.genghuanyonghu.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["xitongsuoping"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["xitongsuoping"].Value.ToString() == "True")
            //    {
            //        roll.xitongsuoping.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["kajintixing"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["kajintixing"].Value.ToString() == "True")
            //    {
            //        roll.kejintixing.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["shengritixing"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["shengritixing"].Value.ToString() == "True")
            //    {
            //        roll.shengritixing.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["jueseguanli"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["jueseguanli"].Value.ToString() == "True")
            //    {
            //        roll.jueseguanli.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["shengritixingshezhi"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["shengritixingshezhi"].Value.ToString() == "True")
            //    {
            //        roll.shengrishezhi.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["huiyuandengji"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["huiyuandengji"].Value.ToString() == "True")
            //    {
            //        roll.huiyuandengji.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["kamiansheji"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["kamiansheji"].Value.ToString() == "True")
            //    {
            //        roll.kamiansheji.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["shangpinshezhi"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["shangpinshezhi"].Value.ToString() == "True")
            //    {
            //        roll.shangpingshezhi.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["shangpinliushui"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["shangpinliushui"].Value.ToString() == "True")
            //    {
            //        roll.shangpingliushui.Checked = true;
            //    }
            //}
            
            //if (dgvroleInfo.CurrentRow.Cells["lipinshezhi"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["lipinshezhi"].Value.ToString() == "True")
            //    {
            //        roll.lipinshezhi.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["xitongrizhi"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["xitongrizhi"].Value.ToString() == "True")
            //    {
            //        roll.xitongrizhi.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["caozuoyuanguanli"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["caozuoyuanguanli"].Value.ToString() == "True")
            //    {
            //        roll.caozuoyuanguanli.Checked = true;
            //    }
            //}

            //if (dgvroleInfo.CurrentRow.Cells["teshuzhekou"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["teshuzhekou"].Value.ToString() == "True")
            //    {
            //        roll.ckbteshuzhekou.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["kehuchaxun"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["kehuchaxun"].Value.ToString() == "True")
            //    {
            //        roll.kehuchaxun.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["yonghugongxian"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["yonghugongxian"].Value.ToString() == "True")
            //    {
            //        roll.yonghugongxianchaxun.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["chongzhichaxun"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["chongzhichaxun"].Value.ToString() == "True")
            //    {
            //        roll.chuzhichaxun.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["shangpinchaxun"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["shangpinchaxun"].Value.ToString() == "True")
            //    {
            //        roll.shangpingchaxun.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["xiaofeiliushui"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["xiaofeiliushui"].Value.ToString() == "True")
            //    {
            //        roll.xiaofeiliushui.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["shourumingxi"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["shourumingxi"].Value.ToString() == "True")
            //    {
            //        roll.shourumingxi.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["huiyuanchuzhi"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["huiyuanchuzhi"].Value.ToString() == "True")
            //    {
            //        roll.huiyuanchuzhijilu.Checked = true;
            //    }
            //}
            //if (dgvroleInfo.CurrentRow.Cells["lipinduihuan"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["lipinduihuan"].Value.ToString() == "True")
            //    {
            //        roll.lipingduihuantongji.Checked = true;
            //    }
            //}
            //roll.ShowDialog();
            updateroll();

        }

        public void updateroll() {
            ID = int.Parse(dgvroleInfo.CurrentRow.Cells["idd"].Value.ToString());
            if (dgvroleInfo.CurrentRow.Cells["roleName"].Value != null && dgvroleInfo.CurrentRow.Cells["roleName"].Value.ToString() == "系统管理员")
            {
                MessageBox.Show("系统管理员不能修改！");
                return;
            }

            RollinfoAdd roll = new RollinfoAdd(this);
            if (dgvroleInfo.CurrentRow.Cells["roleName"].Value != null)
            {
                roll.txtroleName.Text = dgvroleInfo.CurrentRow.Cells["roleName"].Value.ToString();

            }
            if (dgvroleInfo.CurrentRow.Cells["huiyuanxiaofei"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["huiyuanxiaofei"].Value.ToString() == "True")
                {
                    roll.huiyuanxiaofei.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["huiyuanchongzhi"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["huiyuanchongzhi"].Value.ToString() == "True")
                {
                    roll.huiyuanchongzhi.Checked = true;
                }
            }
            //if (dgvroleInfo.CurrentRow.Cells["huiyuanchongzhi"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["huiyuanchongzhi"].Value.ToString() == "True")
            //    {
            //        roll.huiyuanchongzhi.Checked = true;
            //    }
            //}
            if (dgvroleInfo.CurrentRow.Cells["tianjiahuiyuan"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["tianjiahuiyuan"].Value.ToString() == "True")
                {
                    roll.tianjiahuiyuan.Checked = true;
                }
            }
         
            
            if (dgvroleInfo.CurrentRow.Cells["xiugaihuiyuan"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["xiugaihuiyuan"].Value.ToString() == "True")
                {
                    roll.xiugaihuiyuan.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["shanchuhuiyuan"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["shanchuhuiyuan"].Value.ToString() == "True")
                {
                    roll.shanchuhuiyuan.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["guashibanli"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["guashibanli"].Value.ToString() == "True")
                {
                    roll.guashibanli.Checked = true;
                }
            }
          
            if (dgvroleInfo.CurrentRow.Cells["chazhaohuiyuan"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["chazhaohuiyuan"].Value.ToString() == "True")
                {
                    roll.chazhaohuiyuan.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["xiugaikamima"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["xiugaikamima"].Value.ToString() == "True")
                {
                    roll.xiugaikamima.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["genghuanyonghu"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["genghuanyonghu"].Value.ToString() == "True")
                {
                    roll.genghuanyonghu.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["xitongsuoping"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["xitongsuoping"].Value.ToString() == "True")
                {
                    roll.xitongsuoping.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["kajintixing"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["kajintixing"].Value.ToString() == "True")
                {
                    roll.kajintixing.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["tongjiqukuai"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["tongjiqukuai"].Value.ToString() == "True")
                {
                    roll.tongjiqukuai.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["kechengjieduan"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["kechengjieduan"].Value.ToString() == "True")
                {
                    roll.kechengjieduan.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["kehuyuyue"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["kehuyuyue"].Value.ToString() == "True")
                {
                    roll.kehuyuyue.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["jianghuashezhi"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["jianghuashezhi"].Value.ToString() == "True")
                {
                    roll.jianghuashezhi.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["tianjiayonghu"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["tianjiayonghu"].Value.ToString() == "True")
                {
                    roll.tianjiayonghu.Checked = true;
                }
            }

            if (dgvroleInfo.CurrentRow.Cells["shengritixing"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["shengritixing"].Value.ToString() == "True")
                {
                    roll.shengritixing.Checked = true;
                }
            }
          
            //if (dgvroleInfo.CurrentRow.Cells["群发短信"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["群发短信"].Value.ToString() == "True")
            //    {
            //        roll.qunfaduanxin.Checked = true;
            //    }
            //}

            if (dgvroleInfo.CurrentRow.Cells["群发邮件"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["群发邮件"].Value.ToString() == "True")
                {
                    roll.qunfayoujian.Checked = true;
                }
            }
            //if (dgvroleInfo.CurrentRow.Cells["pilianghuiyuandaoru"].Value != null)
            //{
            //    if (dgvroleInfo.CurrentRow.Cells["pilianghuiyuandaoru"].Value.ToString() == "True")
            //    {
            //        roll.pilianghuiyuandaoru.Checked = true;
            //    }
            //}
            if (dgvroleInfo.CurrentRow.Cells["pilianghuiyuandaochu"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["pilianghuiyuandaochu"].Value.ToString() == "True")
                {
                    roll.pilianghuiyuandaochu.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["shengritixingshezhi"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["shengritixingshezhi"].Value.ToString() == "True")
                {
                    roll.shengritixingshezhi.Checked = true;
                }
            }
           
            
            if (dgvroleInfo.CurrentRow.Cells["huiyuandengji"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["huiyuandengji"].Value.ToString() == "True")
                {
                    roll.huiyuandengji.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["kamiansheji"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["kamiansheji"].Value.ToString() == "True")
                {
                    roll.kamiansheji.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["shangpinshezhi"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["shangpinshezhi"].Value.ToString() == "True")
                {
                    roll.shangpinshezhi.Checked = true;
                }
            }
           

            
            if (dgvroleInfo.CurrentRow.Cells["jueseguanli"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["jueseguanli"].Value.ToString() == "True")
                {
                    roll.jueseguanli.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["xiaoshouguanli"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["xiaoshouguanli"].Value.ToString() == "True")
                {
                    roll.xiaoshouguanli.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["shigongguanli"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["shigongguanli"].Value.ToString() == "True")
                {
                    roll.shigongguanli.Checked = true;
                }
            }
         
            if (dgvroleInfo.CurrentRow.Cells["caozuoyuanguanli"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["caozuoyuanguanli"].Value.ToString() == "True")
                {
                    roll.caozuoyuanguanli.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["zhinengjueceguanli"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["zhinengjueceguanli"].Value.ToString() == "True")
                {
                    roll.zhinengjuece.Checked = true;
                }
            }


            
            if (dgvroleInfo.CurrentRow.Cells["kehuchaxun"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["kehuchaxun"].Value.ToString() == "True")
                {
                    roll.kehuchaxun.Checked = true;
                }
            }
               
            
            if (dgvroleInfo.CurrentRow.Cells["yonghugongxian"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["yonghugongxian"].Value.ToString() == "True")
                {
                    roll.yonghugongxianchaxun.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["shangpinchaxun"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["shangpinchaxun"].Value.ToString() == "True")
                {
                    roll.shangpingchaxun.Checked = true;
                }
            }
            //=======
            if (dgvroleInfo.CurrentRow.Cells["huiyuantongji"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["huiyuantongji"].Value.ToString() == "True")
                {
                    roll.huiyuantongji.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["nianlingfenxi"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["nianlingfenxi"].Value.ToString() == "True")
                {
                    roll.nianlingfenxi.Checked = true;
                }
            }
        
            //============
            if (dgvroleInfo.CurrentRow.Cells["shangpingbingtuchaxun"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["shangpingbingtuchaxun"].Value.ToString() == "True")
                {
                    roll.shangpingbintuchaxun.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["huiyuanxingweijilu"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["huiyuanxingweijilu"].Value.ToString() == "True")
                {
                    roll.huiyuanxingweijilu.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["daoqichaxun"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["daoqichaxun"].Value.ToString() == "True")
                {
                    roll.daoqichaxun.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["xitongrizhi"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["xitongrizhi"].Value.ToString() == "True")
                {
                    roll.xitongrizhi.Checked = true;
                }
            }
       

            
            if (dgvroleInfo.CurrentRow.Cells["shourumingxichaxun"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["shourumingxichaxun"].Value.ToString() == "True")
                {
                    roll.shourumingxi.Checked = true;
                }
            }

            
            if (dgvroleInfo.CurrentRow.Cells["zhekouchaxun"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["zhekouchaxun"].Value.ToString() == "True")
                {
                    roll.zhekouchaxun.Checked = true;
                }
            }
            if (dgvroleInfo.CurrentRow.Cells["shangpinliushui"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["shangpinliushui"].Value.ToString() == "True")
                {
                    roll.shangpingliushui.Checked = true;
                }
            }




            if (dgvroleInfo.CurrentRow.Cells["chonghong"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["chonghong"].Value.ToString() == "True")
                {
                    roll.chonghong.Checked = true;
                }
            }


            if (dgvroleInfo.CurrentRow.Cells["xiaofeigaijia"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["xiaofeigaijia"].Value.ToString() == "True")
                {
                    roll.xiaofeigaijia.Checked = true;
                }
            }




            if (dgvroleInfo.CurrentRow.Cells["qingjiaxiugai"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["qingjiaxiugai"].Value.ToString() == "True")
                {
                    roll.qingjiaxiugai.Checked = true;
                }
            }


            if (dgvroleInfo.CurrentRow.Cells["zhipaixiaoshou"].Value != null)
            {
                if (dgvroleInfo.CurrentRow.Cells["zhipaixiaoshou"].Value.ToString() == "True")
                {
                    roll.zhipaixiaoshou.Checked = true;
                }
            }
            roll.ShowDialog();
        }
        int flag = 0;
        private void RollInfo_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (flag == 0)
            {
                e.Cancel = true;
                flag = 1;
                this.timer2.Start();
            }
        }

       

      
    }


}